package top.drinyeit.nongmao.retrofit;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import rx.Observable;
import top.drinyeit.nongmao.model.AddressBean;
import top.drinyeit.nongmao.model.AppHomeBean;
import top.drinyeit.nongmao.model.AppraiseCommodityModel;
import top.drinyeit.nongmao.model.AuthenticationDetailBean;
import top.drinyeit.nongmao.model.BalanceDetailBean;
import top.drinyeit.nongmao.model.CartListBean;
import top.drinyeit.nongmao.model.CategoryGoodsDetailsBean;
import top.drinyeit.nongmao.model.CategoryStoreBean;
import top.drinyeit.nongmao.model.ChildrenOrderBean;
import top.drinyeit.nongmao.model.ChildrenOrderDetailBean;
import top.drinyeit.nongmao.model.ClassificationBean;
import top.drinyeit.nongmao.model.MCartListBean;
import top.drinyeit.nongmao.model.MessageBean;
import top.drinyeit.nongmao.model.OrderBean;
import top.drinyeit.nongmao.model.OrderChildListBean;
import top.drinyeit.nongmao.model.OrderFatherListBean;
import top.drinyeit.nongmao.model.StoreHomeBean;
import top.drinyeit.nongmao.model.StoreInfo;
import top.drinyeit.nongmao.model.TemporaryOrderDetailBean;
import top.drinyeit.nongmao.model.UserInfBean;
import top.drinyeit.nongmao.model.WithdrawDetailBean;
import top.drinyeit.nongmao.model.WxBean;


/**
 * Created by YJY on 2017/10/12.
 */

public interface RetrofitInterface {

    //用户
    //登录1.2
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> login(@Field("action") String action,
                                           @Field("login_phone") String login_phone,
                                           @Field("code") String code);


    //获取用户个人信息
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<UserInfBean>> get_Inf(@Field("action") String action,
                                                  @Field("user_id") String user_id);

    //编辑用户信息
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> edit_Inf(@FieldMap Map<String, Object> map);

    //获取用户收货地址列表
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<List<AddressBean>>> get_add(@Field("action") String action,
                                                        @Field("user_id") String user_id,
                                                        @Field("pageIndex") int pageIndex);

    //新增用户收货地址
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> add_new_add(@Field("action") String action,
                                                 @Field("user_id") String user_id,
                                                 @Field("consignee_name") String consignee_name,
                                                 @Field("consignee_phone") String consignee_phone,
                                                 @Field("address_detail") String address_detail,
                                                 @Field("longitude") String longitude,
                                                 @Field("latitude") String latitude);

    //删除用户收货地址
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> delete_add(@Field("action") String action,
                                                @Field("address_id") int address_id);

    //编辑用户收货地址
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> edit_add(@Field("action") String action,
                                              @Field("address_id") int address_id,
                                              @Field("consignee_name") String consignee_name,
                                              @Field("consignee_phone") String consignee_phone,
                                              @Field("address_detail") String address_detail,
                                              @Field("longitude") String longitude,
                                              @Field("latitude") String latitude);

    //设置默认地址
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> set_de(@Field("action") String action,
                                            @Field("user_id") String user_id,
                                            @Field("address_id") int address_id);

    //获取消息列表
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<List<MessageBean>>> get_message(@Field("action") String action,
                                                            @Field("user_id") String user_id,
                                                            @Field("pageIndex") int pageIndex);

    //标记消息已读
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> set_read(@Field("action") String action,
                                              @Field("message_id") int message_id);

    //删除用户消息
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> delete_message(@Field("action") String action,
                                                    @Field("message_id") int message_id);

    //获取用户当前余额
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<Double>> get_balance(@Field("action") String action,
                                                 @Field("user_id") String user_id);

    //获取用户余额收支明细
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<List<BalanceDetailBean>>> get_bl_de(@Field("action") String action,
                                                                @Field("user_id") String user_id,
                                                                @Field("pageIndex") int pageIndex,
                                                                @Field("pageSize") int pageSize);

    //获取用户提现明细
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<List<WithdrawDetailBean>>> get_w_de(@FieldMap Map<String, Object> map);


    //账号充值卡充值
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> recharge(@Field("action") String action,
                                              @Field("user_id") String user_id,
                                              @Field("card_number") String card_number,
                                              @Field("card_password") String card_password);

    //账号余额提现
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> withdraw(@Field("action") String action,
                                              @Field("user_id") String user_id,
                                              @Field("account_number") String account_number,
                                              @Field("account_name") String account_name,
                                              @Field("account_type") String account_type,
                                              @Field("amount") String amount);

    //获取企业认证详情
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<AuthenticationDetailBean>> get_company(@Field("action") String action,
                                                                   @Field("user_id") String user_id);

    //修改认证信息
    @FormUrlEncoded
    @POST("user")
    Observable<HttpResponse<String>> edit_company(@FieldMap Map<String, Object> map);


    //系统
    //获取验证码
    @FormUrlEncoded
    @POST("system")
    Observable<HttpResponse<String>> get_code(@Field("action") String action,
                                              @Field("login_phone") String login_phone);


    //商城
    //app首页信息
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<AppHomeBean>> get_app(@Field("action") String action);

    //获取所有分类信息
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<ClassificationBean>> get_cla(@FieldMap Map<String, Object> map);

    //获取分类/关键字/某店铺的商品列表（可根据条件搜索）
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<CategoryGoodsDetailsBean>>> categorySearch(@FieldMap Map<String, Object> map);

    //条件分类/关键词搜索店铺列表
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<CategoryStoreBean>>> categoryStoreSearch(@FieldMap Map<String, Object> map);

    //获取商品详情
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<CategoryGoodsDetailsBean>> commodity_detail(@FieldMap Map<String, Object> map);

    //获取店铺首页
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<StoreHomeBean>>> get_store_home(@FieldMap Map<String, Object> map);

    //获取全部宝贝
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<CategoryGoodsDetailsBean>>> get_store_all(@FieldMap Map<String, Object> map);

    //店铺信息
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<StoreInfo>> get_store_info(@FieldMap Map<String, Object> map);

    //店铺内搜索
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<CategoryGoodsDetailsBean>>> shop_search(@FieldMap Map<String, Object> map);


    //获取子订单列表
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<ChildrenOrderBean>>> get_children_order_list(@FieldMap Map<String, Object> map);

    //添加到购物车
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<String>> add_cart(@FieldMap Map<String, Object> map);


    //获取子订单详情
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<ChildrenOrderDetailBean>> get_children_order_detail(@Field("action") String action,
                                                                                @Field("order_id") String order_id);

    //生成订单
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<OrderBean>> add_order(@FieldMap Map<String, Object> map);

    //购物车列表 2018/1/10
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<CartListBean>> cartList(@Field("action") String action,
                                                    @Field("user_id") String user_id);

    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<MCartListBean>> categorCartList(@Field("action") String action,
                                                            @Field("user_id") String user_id);

    //删除购物车 2018/1/11
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<String>> deleteCart(@Field("action") String action,
                                                @Field("ids") String ids);

    //更改购物车商品数量 2018/1/12
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<String>> changeCartNumber(@Field("action") String action,
                                                      @Field("id") String id,
                                                      @Field("commodity_sum") int commodity_sum);

    //购物车下单 2018/1/12
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<TemporaryOrderDetailBean>> cartAccount(@Field("action") String action,
                                                                   @Field("temp_order_params") String temp_order_params);

    //获取父订单列表 2018/1/13
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<OrderFatherListBean>>> getFatherOrderList(@Field("action") String action,
                                                                           @Field("user_id") String user_id,
                                                                           @Field("state_flag") int state_flag,
                                                                           @Field("pageIndex") int pageIndex);

    //获取子订单列表 2018/1/13
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<List<OrderChildListBean>>> getChildOrderList(@Field("action") String action,
                                                                         @Field("parent_order_id") String parent_order_id);


    //支付
    //订单支付
    //支付宝支付
    @FormUrlEncoded
    @POST("weilongPay")
    Observable<HttpResponse<String>> zfb_payment(@Field("action") String action,
                                                 @Field("type") int type,
                                                 @Field("order_price") BigDecimal order_price,
                                                 @Field("order_id") String order_id);


    //微信支付
    @FormUrlEncoded
    @POST("weilongPay")
    Observable<HttpResponse<WxBean>> vx_payment(@Field("action") String action,
                                                @Field("type") int type,
                                                @Field("order_price") BigDecimal order_price,
                                                @Field("order_id") String order_id);

    //余额支付
    @FormUrlEncoded
    @POST("weilongPay")
    Observable<HttpResponse<String>> balance_payment(@Field("action") String action,
                                                     @Field("type") int type,
                                                     @Field("order_price") BigDecimal order_price,
                                                     @Field("order_id") String order_id);

    //线下扫码支付
    @FormUrlEncoded
    @POST("weilongPay")
    Observable<HttpResponse<String>> scan_payment(@Field("action") String action,
                                                  @Field("user_id") String user_id,
                                                  @Field("payment_amount") BigDecimal payment_amount,
                                                  @Field("store_str") String store_str);

    //删除订单
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<String>> delete_order(@Field("action") String action,
                                                  @Field("parent_order_id") String parent_order_id);

    //取消订单
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<String>> cancel_order(@Field("action") String action,
                                                  @Field("parent_order_id") String parent_order_id);

    //获取未评价商品(跳转订单评价页面)
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<AppraiseCommodityModel>> find_appraise(@Field("action") String action,
                                                                   @Field("children_order_id") String children_order_id);

    //提交订单评价
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<String>> order_appraise(@Field("action") String action,
                                                    @Field("order_appraise") String order_appraise);

    //确认收货
    @FormUrlEncoded
    @POST("commodity")
    Observable<HttpResponse<String>> confirm_receipt(@Field("action") String action,
                                                     @Field("parent_order_id") String parent_order_id);
}
